package com.glsc.ngateway.common.base.domain.mysql.opmanagemain.archive;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.glsc.ngateway.common.api.common.enums.DictConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author liwei
 * 交易对手方信息表
 */
@Data
@Entity
@Table(name = "t_counter_party")
@org.hibernate.annotations.Table(appliesTo = "t_counter_party", comment = "档案客户信息表")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CounterParty implements Serializable {
    private static final long serialVersionUID = 5056877189412783890L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int(20) comment '交易对手方id'")
    private Integer id;

    @ApiModelProperty(value = "交易对手方名称")
    @Column(name = "party_name", columnDefinition = "varchar(255) COMMENT '交易对手方名称'")
    private String partyName;

    @ApiModelProperty(value = "交易对手方组织机构代码")
    @Column(name = "party_organ_code", columnDefinition = "varchar(100) COMMENT '交易对手方组织机构代码'")
    private String partyOrganCode;

    @ApiModelProperty(value = "备注")
    @Column(name = "memo", columnDefinition = "varchar(255) COMMENT '备注'")
    private String memo;

    @ApiModelProperty(value = "是否启用，字典 YesNo:（N=禁用 Y=启用)")
    @Column(name = "enable_flag", columnDefinition = "varchar(20) default 'N' COMMENT '是否启用，字典 YesNo:（N=禁用 Y=启用)'")
    private String enableFlag;

    @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;


}
